
const isProd = process.env.NODE_ENV === 'production'
const webpack = require('webpack')

module.exports = {
  outputDir: 'dist',
  assetsDir: 'static',
  configureWebpack: {
    devtool: isProd ? false : 'source-map',
    devServer: {
      open: true,
      // proxy: {
      //   '/api': {
      //     target: 'http://localhost:3000',
      //     pathRewrite: { '^/api': '' },
      //     changeOrigin: true,
      //     secure: false,
      //   },
      // },
      port: 80,
    },
    externals: isProd ? {
      vue: 'Vue',
      'vue-router': 'VueRouter',
      vuex: 'Vuex',
      axios: 'axios',
    } : {},
    plugins: [
      new webpack.ProvidePlugin({
        $: 'jquery',
        jquery: 'jquery',
      }),
    ],
  },
}
